package com.yihu.yihuds.action;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yihu.cms.action.BaseController;
import com.yihu.cms.service.ArtworkQueryService;
import com.yihu.web.bean.vo.CollectQuery;
import com.yihu.web.bean.vo.Collection;
/***
 * 收藏
 * @author Aaron
 *
 */
@Controller
public class CollectionController extends BaseController{
	ArtworkQueryService service = new ArtworkQueryService();
	
	//我的所有关注列表
	@RequestMapping(value = "/user/collects" ,method = RequestMethod.GET)
	public @ResponseBody Object getAllCollects(CollectQuery query) {
		return service.getCollectsByUserId(query);
	}
	
	//如果是从购物车加入我的关注，fromcart置为true
	@RequestMapping(value = "/user/collect", method = RequestMethod.POST)
	public @ResponseBody Object collect(@RequestBody Collection collection ) {
		return service.addCollect(collection);
	}
	
	@RequestMapping(value = "/user/collect", method = RequestMethod.DELETE)
	public @ResponseBody Object cancelCollect(Collection collection ) {
		return service.deleteCollect(collection);
	}
}
